#!/bin/bash

## run program

apps="jkstatus jksys jkimgproc jkws"

cur=`pwd`

function log() {
	echo "$*"
}

while true
do
    for i in $apps
    do
		bin=./bin/$i
    	ps ax | grep $bin | grep -v grep &> /dev/null
		ret=$?
    	if [ $ret -gt 0 ]; then
            log "run $bin ..."
    	    $bin &
    		sleep 1
    	fi
    done

	sleep 5
done

